package com.ghsc.ghxc.jsb.ui.home.view

import android.widget.ImageView
import android.widget.TextView
import androidx.fragment.app.FragmentActivity
import androidx.recyclerview.widget.RecyclerView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.cn.appcore.ext.setSingleClickListener
import com.ghsc.ghxc.jsb.R
import com.lxj.xpopup.core.CenterPopupView


class IntegralRulePopView(context: FragmentActivity, rules:MutableList<String>,tvTitle:String) : CenterPopupView(context) {



    val list = rules
    val tvTitle=tvTitle


    override fun getImplLayoutId() = R.layout.popup_integral_rule



    override fun onCreate() {
        super.onCreate()
        val tvTitle = findViewById<TextView>(R.id.tvTitle)
        tvTitle.text=this.tvTitle

        val rvRule = findViewById<RecyclerView>(R.id.rvRule)
        val imgBtnClose = findViewById<TextView>(R.id.imgBtnClose)
        val adapter = IntegralRuleAdapter()
        rvRule.adapter = adapter
        adapter.setNewInstance(list)
        imgBtnClose.setSingleClickListener { dismiss() }

    }



    class IntegralRuleAdapter :BaseQuickAdapter<String, BaseViewHolder>(R.layout.item_integral_rule){
        override fun convert(holder: BaseViewHolder, item: String) {
            holder.setText(R.id.tvRule,item)

        }
    }
}